# Replication data for: 
# Racial Social Norms among Brazilian Students: Academic Performance, Social Status and
# Racial Identification

These files replicate the results in Racial Social Norms among Brazilian Students: 
Academic Performance, Social Status and3Racial Identification, submitted to PNAS and currently
under review. 

There are two files with data. The CSV file data_11.csv contains the answers students gave in
questionnaries as well as their grades collected in their transcripts. The file 
list_anonymous_networks.Rds contains data on students' friendship networks.

The files are divided in three big groups. The first contains the R scripts responsible
for replicating the descriptive analysis and the main result (Table 2 in the main text).
The second group contains the robustness checks for the main result, which are stored in 
the folder "robustness".

You can run both groups of scripts by running 0_main_script_en.R, which calls all other R 
scripts. 
The script will create three folder: 
intermediary_outputs, that will contain 
outputs that will be used in other scripts; 
figures and tables, which will contain all the results. 

PLEASE, RECALL TO SET THE WORKING FOLDER TO THE ONE WHERE THE CODES AND DATA ARE STORED!

Next, we have three Stata do-files, responsible for the multinomial logit analysis. You can
run all the analysis by running 11_global_stata, which will call the other two do-files.
Outputs are stored in the figures and tables folders, so you must run the R scripts before
the Stata do-files.

List of files:
- Data and documentarion:
read_me.txt # This file
data_11.csv # Data on students
list_anonymous_networks.Rds # Friendship network data
CODEBOOK.pdf # codebook for data in 

- Main Analysis:
00_main_script_en.R # Call all other R codes
01_select_sample_en.R # Selects the analytical sample
02_prepare_networks_en.R # Clean the friendship network data
03_create_vars_en.R # Create some variables used in the analysis
04_compute_index_en.R # Computes social status index
04a_supporting_funciton_en.R # Create functions used to compute social status index
05_grades_score_en.R # Computes the grades score
06_descriptive_en.R # Creates the main descriptive tables and figures
07_example_ssi_en.R # Examples figures for the social status index in the SI appendix
08_nonparametric_analysis_en.R # Nonparametric relation between grades and social status
09_run_regs_en.R # Call codes to replicate the main results
09a_supp_function_regressions_en.R # Supporting functions to main analysis
09b_regs_1_en.R # Main results
09c_sep_het_linear_en.R # Main results, separate regressions for each race
10_robustness_checks_en.R # Call the R codes for robustness checks

- Robustness Analysis
01_support_robustness_en.R # Create the main functions used in the robustness analysis
02_robustness_skin_group_en.R # Robustness on skin group definition
03_robustness_skin_color_interaction_en.R # Robustness with skin color
04_robustness_race_simple_1_en.R # Robustness splitting the nonwhite group
05_robustness_separate_regs_en.R # Runs the main results for each group separetely
06_robustness_supply_en.R # Robustness to supply of friends
07_robustness_other_dep_var_en.R # Main regression using different dependent variables
08_robust_decriptive_en.R # Create main groups to test robustness for sample selection
09_compute_index_robust_descriptive_en.R # Create main variables for analysis for different samples
10_robustness_sample_en.R # Run the robustness on different sample selections

- Multinomial logit (Stata codes)
11_global_stata.do # Call the other two Stata codes for multinomial logit regressions
12_mlogit_analysis.do # Main code for multinomial analysis of race identification
13_mlogit_analysis_het.do # Heterogeneity analysis on multinomial logit

